package com.design.interpreter.format;

import java.util.Date;

public class InterpreterDateFormatDemo {
    public static void main(String[] args) {
        Date currentDate = new Date();

        FormatExpression yearMonthDayExpression = new YearMonthDayExpression();
        FormatExpression monthDayYearExpression = new MonthDayYearExpression();

        DateFormatContext context1 = new DateFormatContext(yearMonthDayExpression);
        DateFormatContext context2 = new DateFormatContext(monthDayYearExpression);

        String formattedDate1 = context1.format(currentDate);
        String formattedDate2 = context2.format(currentDate);

        System.out.println("Formatted Date 1: " + formattedDate1);
        System.out.println("Formatted Date 2: " + formattedDate2);
    }
}
